<template>
  <view class="com-notice">
    <view class="left">
      <uni-icons type="sound-filled" color="#ffab96" size="20"></uni-icons>
      <text class="text">公告</text>
    </view>

    <view class="center">
      <view v-if="isEmpty" class="swiper">
        <text class="swiper-item">暂无数据</text>
      </view>
      <swiper v-else vertical autoplay circular interval="2000" class="swiper">
        <swiper-item @click="goNoticeDetail(item._id)" v-for="item in dataList" :key="item?._id" class="swiper-item">
          {{ item?.title }}
        </swiper-item>
      </swiper>
    </view>

    <view class="right">
      <uni-icons type="right" color="#ccc" size="16"></uni-icons>
    </view>
  </view>
</template>


<script lang="ts" setup>
const props = defineProps({
  dataList: {
    type: Array as any,
    default: () => []
  },
  isEmpty: {
    type: Boolean,
    default: true
  },
});

const goNoticeDetail = (id: string) => {
  uni.navigateTo({
    url: `/pages/pkgB/noticeDetail/index?id=${id}`
  })
};
</script>


<style lang="scss" scoped>
@use "style.scss";
</style>